This AppleScript will find a random paragraph on a random page of your wiki, and then
display it in a window. It also has some neat features built into it, such as:


property minWords : 10
property maxPageTries : 10
property maxDocTries : 10
(*
July 7, 2005
100% original code written by Michael Henley (mike.com@mac.com)
http://silvermeteors.com
-
This is Emailware, ergo, if you use this script regularly, or if you
use any part of it in your own scripts, you must send me a nice
email telling me how great I am. Thank you.
*)
set theCommand to "Try Again"
repeat while theCommand is "Try Again"
	set randomResult to getRandomText()
	set vpPage to (item 1 of randomResult)
	set randomText to (item 2 of randomResult)
	set randomMessage to "[" & vpPage & "]" & return & randomText
	set theCommand to button returned of ¬
		(display dialog randomMessage buttons {"Cancel", "Options", "Try Again"} default button 3)
	repeat while theCommand is not "Try Again"
		if theCommand is "Less Options" then
			set theCommand to button returned of ¬
				(display dialog randomMessage buttons {"Cancel", "Options", "Try Again"} default button 3)
		else if theCommand is "Options" then
			set theCommand to button returned of ¬
				(display dialog randomMessage buttons {"More Options", "Copy Clip", "Open Page"} default button 3)
		else if theCommand is "More Options" then
			set theCommand to button returned of ¬
				(display dialog randomMessage buttons {"Less Options", "Open URLs", "Configure"} default button 3)
		else if theCommand is "Copy Clip" then
			set the clipboard to vpPage & ": " & randomText
			set theCommand to "Less Options"
		else if theCommand is "Open Page" then
			tell application "VoodooPad" to tell document 1 to open page with title vpPage
			set theCommand to "Less Options"
		else if theCommand is "Open URLs" then
			try
				set theURLs to getURLs(randomText) as list
				if length of theURLs is 1 then
					set theURL to theURLs as string
				else
					set theURL to choose from list theURLs
				end if
				open location theURL
				tell me to activate
				set theCommand to "Less Options"
			on error
				set URLerror to return & return & "Error! Couldn't find any URLs. Please select another option."
				set theCommand to button returned of ¬
					(display dialog randomMessage & URLerror buttons {"More Options", "Copy Clip", "Open Page"} default button 3)
			end try
		else if theCommand is "Configure" then
			set minWords to text returned of ¬
				(display dialog "Only find paragraphs longer than
				this number of words:" default answer minWords)
			set maxPageTries to text returned of ¬
				(display dialog "Maximum attempts per page:" default answer maxPageTries)
			set maxDocTries to text returned of ¬
				(display dialog "Maximum attempts per document:" default answer maxDocTries)
			set theCommand to "Less Options"
		end if
	end repeat
end repeat
on getRandomText()
	(*
July 7, 2005
100% original code written by Michael Henley (mike.com@mac.com)
http://silvermeteors.com
-
This is Emailware, ergo, if you use this script regularly, or if you
use any part of it in your own scripts, you must send me a nice
email telling me how great I am. Thank you.
*)
	tell application "VoodooPad"
		set randomRange to the count of pages of document 1
		repeat maxDocTries times
			set randomPage to (random number randomRange)
			set randomParaRange to count of paragraphs of (text of page randomPage of document 1)
			set randomPage to name of page randomPage of document 1
			repeat maxPageTries times
				set randomPara to (random number randomParaRange)
				set randomText to (paragraph randomPara of text of page randomPage of document 1) as text
				if (count of words of randomText) is greater than or equal to minWords then
					return {randomPage, randomText}
				end if
			end repeat
		end repeat
		return {randomPage, "Couldn't find a paragraph longer than " & minWords ¬
			& " words after " & maxPageTries & " attempts on " & maxDocTries & " pages."}
	end tell
end getRandomText
on getURLs(sourceText)
	(*
July 7, 2005
100% original code written by Michael Henley (mike.com@mac.com)
http://silvermeteors.com
-
This is Emailware, ergo, if you use this script regularly, or if you
use any part of it in your own scripts, you must send me a nice
email telling me how great I am. Thank you.
*)
	set endDelim to " " (* change this value if you're looking for
	 something other than a space at the end of your URLs *)
	set URLList to {}
	set oldDelims to AppleScript's text item delimiters
	set AppleScript's text item delimiters to "
" -- strip carriage returns
	set sourceText to text items of sourceText
	set AppleScript's text item delimiters to endDelim
	set sourceText to sourceText & endDelim as string
	set URISchemes to {"http:", "https:", "file:", "ftp:", "mailto:", "aim:", "telnet:", "news:", "rtsp:", "afp:", "eppc:", "rss:"}
	repeat with delim from 1 to length of URISchemes
		set delim to item delim of URISchemes as string
		set AppleScript's text item delimiters to delim
		set trimText to {}
		repeat with x from 2 to length of sourceText's text items
			set trimText to trimText & (text item x of sourceText) as list
		end repeat
		set AppleScript's text item delimiters to endDelim
		repeat with x from 1 to length of trimText
			set URLList to URLList & (delim & text item 1 of item x of trimText) as list
		end repeat
	end repeat
	set AppleScript's text item delimiters to oldDelims
	return URLList
end getURLs

Script submitted by – mike [dot] com [at] mac [dot] com